using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;

namespace Dogfight2008.Common.Tests
{
  [TestFixture]
  public class FixedListFixture
  {
    [Test]
    public void Constr()
    {
      FixedList<int> list = new FixedList<int>();
    }

    [Test]
    public void Count()
    {
      FixedList<string> list = new FixedList<string>("hej", "hej");
      Assert.AreEqual(2, list.Count);
    }

    [Test]
    public void ChangingInputDoesNotChangeList()
    {
      List<int> input = new List<int>();
      input.AddRange(new int[] { 1, 2, 3 });
      FixedList<int> list = new FixedList<int>(input);
      input[1] = 0;
      Assert.AreEqual(2, list[1]);
    }

    [Test]
    public void Equals()
    {
      FixedList<int> l1 = new FixedList<int>(1, 2, 3);
      FixedList<int> l2 = new FixedList<int>(1, 2, 3);
      Assert.AreEqual(l1, l2);
    }

    [Test]
    public void NotEquals()
    {
      FixedList<int> l1 = new FixedList<int>(1, 2, 3);
      FixedList<int> l2 = new FixedList<int>(1, 3, 2);
      Assert.AreNotEqual(l1, l2);
    }

    [Test]
    public void Sublist()
    {
      FixedList<int> list = new FixedList<int>(1, 2, 3, 4, 5);
      FixedList<int> sub = list.Sublist(2, 2);
      FixedList<int> expected = new FixedList<int>(3, 4);
      Assert.AreEqual(expected, sub);
    }
  }
}
